package com.da.javatest.leetCode;

/**
 * @author chenlida
 * @date 2019/1/10 19:01
 * @description
 */
public class Code824 {
    public String toGoatLatin(String S) {
        StringBuilder sb = new StringBuilder();
        String[] strs = S.split(" ");
        for (int i = 1; i <= strs.length; i++) {
            String s = strs[i - 1].toLowerCase();
            if ("aeiou".contains(s.charAt(0) + "")) {
                sb.append(strs[i - 1]).append("ma");
            } else {
                sb.append(strs[i - 1].substring(1) + strs[i - 1].charAt(0)).append("ma");
            }
            for (int j = 0; j < i; j++) {
                sb.append("a");
            }
            sb.append(" ");
        }
        return sb.toString().trim();
    }
}
